package com.resign.carl.decorate.api.impl;

import com.resign.carl.decorate.api.Beverage;
import com.resign.carl.decorate.enumeration.CapSize;

/**
 *
 * Created by carl.zhao on 2016/6/14.
 */
public class Espresso extends Beverage {

    public Espresso(){
        description = "espresso";
    }

    @Override
    public double cost() {
        final CapSize capSize = getCapSize();
        if(null == capSize){
            throw new NullPointerException("cap size can't be null");
        }
        description = description.concat("(" + capSize.getDescription() + ")");
        switch (capSize){
            case TALL:
                return 1.99 + .10;
            case GRANDE:
                return 1.99 + 0.15;
            case WENTI:
                return 1.99 + .20;
            default:
                return 1.99;
        }
    }
}
